package com.heyun.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Service;

import com.heyun.bean.HeyunEmp;
import com.heyun.dao.HeyunEmpDao;
import com.heyun.service.HeyunEmpService;
@Service
public class HeyunEmpImpl implements HeyunEmpService {
	public static void main(String[] args) {
		ApplicationContext context =new ClassPathXmlApplicationContext("config/spring-default.xml");
		HeyunEmpService hes= (HeyunEmpService) context.getBean("heyunEmpImpl");
		List <HeyunEmp>list = hes.listEmp();
		for(HeyunEmp l:list){
		System.out.println(l.getEmpLoginName());
		System.out.println(l.getHyd().getDeptAllName());
		System.out.println(l.getHye().getEmpRealName());
		}
	}
	
   @Autowired
    HeyunEmpDao hyed;
	@Override
	public int insertEmp(HeyunEmp hye) {
		// TODO Auto-generated method stub
		int a=hyed.insertEmp(hye);
		return a;
	}

	@Override
	public int removeEmp(int empId) {
		// TODO Auto-generated method stub
		int a =hyed.removeEmp(empId);
		return a;
	}

	@Override
	public int updateEmp(HeyunEmp hye) {
		// TODO Auto-generated method stub
		int a=hyed.updateEmp(hye);
		return a;
	}

	@Override
	public List<HeyunEmp> listEmp() {
		// TODO Auto-generated method stub
		List<HeyunEmp> list=hyed.listEmp();
		
		return list;
	}

	@Override
	public HeyunEmp getEmp(int empId) {
		// TODO Auto-generated method stub
		HeyunEmp hye=hyed.getEmp(empId);
		return hye;
	}

	@Override
	public HeyunEmp getEmpByName(String empLoginName) {
		// TODO Auto-generated method stub
		HeyunEmp hye=hyed.getEmpByName(empLoginName); 
		return hye;
	}

	@Override
	public List<HeyunEmp> findEmplist(Map map) {
		// TODO Auto-generated method stub
		List<HeyunEmp> emplist = hyed.findEmplist(map);
		return emplist;
	}

	@Override
	public int updateEmpState(Map map) {
		// TODO Auto-generated method stub
		int a=hyed.updateEmpState(map);
		return a;
	}

}
